<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <input type="text">
<script>
  const input=document.querySelector('input')
  input.addEventListener('keydown',function (){
    console.log('键盘按下了')
  })
</script>
</body>
</html>